package cn.java83cloud.springcloudclient.service;

import cn.java83cloud.springcloudclient.entity.Advtise;
import cn.java83cloud.springcloudclient.entity.Page;
import cn.java83cloud.springcloudclient.entity.Result;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.format.annotation.DateTimeFormat;
import org.springframework.web.bind.annotation.*;

import javax.ws.rs.Path;
import java.util.Date;

@FeignClient("springcloud-serve")
public interface AdvService {

    @PostMapping("/adv/add")
    public Result add(@RequestBody Advtise adv);

    @GetMapping("/adv/get/{id}")
    public Result get(@PathVariable("id") Long id);

    @GetMapping("/adv/list")
    public Page<Advtise> search(@RequestParam(name = "page", defaultValue = "1") int page,
                                @RequestParam(name = "pageSize", defaultValue = "10") int pageSize,
                                @RequestParam(name = "title", required = false) String title,
                                @DateTimeFormat(pattern = "yyyy-MM-dd") @RequestParam(name = "start", required =
                                        false) Date start,
                                @DateTimeFormat(pattern = "yyyy-MM-dd") @RequestParam(name = "end", required = false) Date end);
}